package com.asset.admin.system.syemenu.form;

import com.asset.admin.dao.entity.SysMenuEntity;
import com.fasterxml.jackson.annotation.JsonInclude;

import java.util.List;

/**
 * <p>
 * todo 描述
 * </p>
 *
 * @author 牧之
 * @date 2024/2/27 15:43
 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class SysMenuForm {

    private Integer key;
    private Integer pid;
    private String label;
    private String icon;
    private String type;
    private String url;
    private List<SysMenuForm> children;

    public Integer getKey() {
        return key;
    }

    public void setKey(Integer key) {
        this.key = key;
    }

    public Integer getPid() {
        return pid;
    }

    public void setPid(Integer pid) {
        this.pid = pid;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }


    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public List<SysMenuForm> getChildren() {
        return children;
    }

    public void setChildren(List<SysMenuForm> children) {
        this.children = children;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public static SysMenuForm convert2MenuForm(SysMenuEntity entity){
        SysMenuForm form = new SysMenuForm();
        if(entity == null){
            return form;
        }
        form.setKey(entity.getId());
        form.setPid(entity.getPid());
        form.setLabel(entity.getName());
        form.setIcon(entity.getIcon());
        form.setUrl(entity.getUrl());
        return form;
    }
}
